﻿@using Smartstore.Web.Models.Customers;

@model CustomerRewardPointsModel

@{
    Assets.AppendTitleParts(T("PageTitle.Account"));

    Layout = "_MyAccount";
    ViewBag.PageClassToken = "rewardpoints";
    ViewBag.PageTitle = T("Account.RewardPoints").Value;
}

<div class="alert alert-info">
    @Model.RewardPointsBalanceFormatted
</div>

<fieldset class="content-group mt-4">
    <legend class="mb-0"><span>@T("RewardPoints.History")</span></legend>
    <div class="reward-points-history">
        @if (Model.RewardPoints.Count == 0)
        {
            <div class="alert alert-warning mt-3">
                @T("RewardPoints.NoHistory")
            </div>
        }
        else
        {
            <div class="table-responsive">
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th class="border-top-0">
                                @T("Common.CreatedOn")
                            </th>
                            <th class="border-top-0">
                                @T("RewardPoints.Fields.Points")
                            </th>
                            <th class="border-top-0">
                                @T("RewardPoints.Fields.PointsBalance")
                            </th>
                            <th class="border-top-0">
                                @T("RewardPoints.Fields.Message")
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach(var item in Model.RewardPoints)
                        {
                            <tr>
                                <td>@item.CreatedOn.ToNativeString()</td>
                                <td>@item.Points.ToString("N0")</td>
                                <td>@item.PointsBalance.ToString("N0")</td>
                                <td dir="auto">@item.Message</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        }
    </div>
</fieldset>